package com.huage.courseplatform.application.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huage.courseplatform.application.model.entity.Business;
import com.huage.courseplatform.application.model.entity.Teacher;
import com.huage.courseplatform.application.model.vo.BusinessTeacherFlowRecordVO;
import com.huage.courseplatform.framework.config.MybatisRedisCache;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
//@CacheNamespace(implementation= MybatisRedisCache.class,eviction= MybatisRedisCache.class)
public interface TeacherMapper extends BaseMapper<Teacher> {

    //根据BusinessId查询教师列表
    List<Teacher> getTeacherListByBusinessId(String businessId);

    //根据UserId查询教师
    Teacher getTeacherByUserId(String userId);

    //根据教师ID联查申请记录
    List<BusinessTeacherFlowRecordVO> getTeacherApplyList(String id);

    /*
      中间表 UserTeacher
    */
    int insertUserTeacherById(@Param("userId") String userId, @Param("teacherId") String teacherId);

    int delUserTeacherById(@Param("userId") String userId, @Param("teacherId") String teacherId);

    /*
        中间表 BusinessTeacher
     */
    int insertBusinessTeacherById(@Param("businessId") String businessId, @Param("teacherId") String teacherId);

    int delBusinessTeacherById(@Param("businessId") String businessId, @Param("teacherId") String teacherId);

}
